package com.springcloud.demo.dynamicTable.dynamic.service.serviceImpl;

import com.springcloud.demo.dynamicTable.autocode.utils.StringUtils;
import com.springcloud.demo.dynamicTable.dynamic.dao.MetaInfoDao;
import com.springcloud.demo.dynamicTable.dynamic.entity.MetaInfoDO;
import com.springcloud.demo.dynamicTable.dynamic.service.MetaInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class MetaInfoServiceImpl implements MetaInfoService {
	@Autowired
	private MetaInfoDao metaInfoDao;
	
	@Override
	public MetaInfoDO get(String id){
		return metaInfoDao.get(id);
	}
	
	@Override
	public List<MetaInfoDO> list(Map<String, Object> map){
		return metaInfoDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return metaInfoDao.count(map);
	}
	
	@Override
	public int save(MetaInfoDO metaInfo){
	    if (StringUtils.isEmpty(metaInfo.getId())) {
            metaInfo.setId(StringUtils.getUUID());
		}

		return metaInfoDao.save(metaInfo);
	}
	
	@Override
	public int update(MetaInfoDO metaInfo){
		return metaInfoDao.update(metaInfo);
	}
	
	@Override
	public int remove(String id){
		return metaInfoDao.remove(id);
	}
	
	@Override
	public int batchRemove(String[] ids){
		return metaInfoDao.batchRemove(ids);
	}
	
}
